﻿using System;
using System.Collections.Generic;
using System.Linq;
using LightPersist;
using LightPersist.Storage;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TestDomainModel;

namespace LightPersistTests
{
	[TestClass]
	public class Simple_api
	{
		[TestMethod]
		public void Should_allow_create_context_simply()
		{
			var db = LightPersistFactory.Open<InmemoryStorage, TestDomainModelMetainfo>("test database");
			var root = db.RootClass<FakeRoot>();
			db.Execute = delegate { var child = root.Children.AddNew(); };

			Assert.AreEqual(1, root.Children.Count);
		}
	}
}